package com.gxa.javaserver.config;

import com.gxa.javaserver.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author:Teacher黄
 * @date:Created at 2020/06/05
 */
//@Configuration
public class InterceptorConfig implements WebMvcConfigurer {


    /**
     * 添加拦截器- 项目中的连接器
     * 桌面修改
     * 项目修改
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor())
                // 配置需要拦截的路径
                .addPathPatterns("/**")
                // 配置不拦截的路径
                .excludePathPatterns("/login/page","/login/do")
                // 拦截器放行静态资源
                .excludePathPatterns("/css/**","/fonts/**","/images/**","/js/**","/lib/**");


    }
}
